package com.zb.entity.dto;

import cn.dev33.satoken.spring.SpringMVCUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.entity.ZjAdmWxTemplate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/7/12 0012
 **/
@Data
@ApiModel("微信消息模板详情")
public class WxTemplateInfoDto {
    @ApiModelProperty(value = "主健ID")
    private Long id;

    @ApiModelProperty(value = "模板库中模板的编号，有“TM**”和“OPENTMTM**”等形式,对于类目模板，为纯数字ID")
    private String templateIdShort;

    @ApiModelProperty(value = "标题")
    private String name;

    @ApiModelProperty(value = "所属类目")
    private String category;

    @ApiModelProperty(value = "场景说明")
    private String remark;

    @ApiModelProperty(value = "应用模块")
    private String module;

    @ApiModelProperty(value = "接收角色")
    private String role;

    @ApiModelProperty(value = "示例内容消息")
    private String example;

    @ApiModelProperty(value = "是否禁用：false-否，true-是")
    private Boolean disabled;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "微信消息模板内容")
    private List<WxTemplateContent> contentList;

    public static WxTemplateInfoDto beanToInfo(ZjAdmWxTemplate template, List<WxTemplateContent> contentList) {
        WxTemplateInfoDto info = new WxTemplateInfoDto();
        BeanUtils.copyProperties(template, info);
        info.setCreateTime(template.getGmtCreate());
        info.setUpdateTime(template.getGmtUpdate());
        info.setContentList(contentList);
        return info;
    }
}
